<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>展示</title>
    <link rel="icon" href="../../img/logoimg.png" type="image/ico">
</head>
<script type="text/javascript" src="../../js/jquery-3.6.0.min.js"></script>
<div th:include="common/style"></div>
<body style="background: #f7f1e3;">
<form th:action="@{updateAuthor}" th:onsubmit="return checkAll()">
    <input type="hidden" th:value="${user.uId}" name="uId">
    <table class="authorInfo">
        <tr >
            <td>作者笔名：</td>
            <td><input th:value="${user.uName}" name="uName" disabled placeholder="待完善" ></td>
        </tr>
        <tr>
            <td>QQ号码：</td>
            <td><input th:value="${user.uQq}" name="uQq" placeholder="待完善" ></td>
        </tr>
        <tr>
            <td>真实姓名：</td>
            <td><input th:value="${user.uRealname}" name="uRealname" placeholder="待完善" ></td>
        </tr>
        <tr>
            <td>联系方式：</td>
            <td>
                <input th:value="${user.uTel}" name="uTel" id="utel" placeholder="待完善" >
            </td>
        </tr>
        <tr>
            <td>身份证号：</td>
            <td>
                <input th:value="${user.uIdnum}" name="uIdnum" id="uidnum" placeholder="待完善" >
            </td>
        </tr>
        <tr>
            <td>收货地址：</td>
            <td><input th:value="${user.uAddress}" name="uAddress" placeholder="待完善"></td>
        </tr>
        <tr>
            <td>银行卡号：</td>
            <td>
                <input th:value="${user.uBanknum}" name="uBanknum" id="ubanknum" placeholder="待完善" >
            </td>
        </tr>
        <tr>
            <td></td>
            <td>
                <input class="btn-primary" type="submit" value="保存" >
            </td>
        </tr>
    </table>
</form>
</body>
<script>
    function checkAll(){
        var f1=checkTel();
        var f2=checkId();
        var f3=checkBankcode();
        if (f1&&f2&&f3){
            return true;
        }else {
            //alert("信息不合法，请检查");
            return false;
        }

    }
    function checkTel(){
        var tel = /^[0-9]{11}$/;
        if(tel.test($("#utel").val())){
            return true;
        }else {
            alert("请输入正确的11位电话号码");
            return false;
        }
    }
    function checkId(){
        var  tel =/(^[0-9]{18}$)/;
        if(tel.test($("#uidnum").val())){
            return true;
        }else {
            alert("请输入正确的18位身份证号！");
            return false;
        }
    }
    function checkBankcode(){
        var tel = /^[0-9]{16,19}$/;
        if(tel.test($("#ubanknum").val())){
            return true;
        }else {
            alert("请输入16-19位银行卡号！");
            return false;
        }
    }
</script>
</html>